//
//  Game.h
//  QuizMaster
//
//  Created by Jeppe Nielsen on 3/10/15.
//  Copyright (c) 2015 Jeppe Nielsen. All rights reserved.
//

#pragma once
#include "Engine.hpp"
#include "GameWorld.hpp"
#include "RenderSystem.hpp"
#include "QuestionDatabase.hpp"
#include "CategoryDatabase.hpp"
#include "FileDownloader.hpp"
#include "Gui.hpp"
#include "GameData.hpp"
#include "CategoryComponent.hpp"
#include "CategoryFactory.hpp"
#include "BigButtonManager.hpp"

using namespace Nano;

class Game : public GameState<Game> {
private:
    
    RenderSystem* renderer;
    QuestionDatabase questionDatabase;
    
    FileDownloader downloader;
    
public:
    GameData data;

    GameWorld world;
    Gui* gui;
    GameObject* font;
    BigButtonManager bigButtonManager;
    CategoryFactory* categoryFactory;
    
    CategoryDatabase categoryDatabase;
    
private:
    void DownloadQuestionsComplete(Nano::DownloadedFile file);
    void DownloadCategoriesComplete(Nano::DownloadedFile file);
    void ButtonDown(std::string button);
    void SetupCameras();
    
    void GamePadButtonDown(GamePadData data);
    void BigButtonDown(BigButtonEvent button);
    void BigButtonUp(BigButtonEvent button);
    
protected:
    void Initialize();
    void Update(float dt);
    void Render();
};
